#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lex.yy.c"
int myerror = 0;
NODE *root;
NODE *child[10];

int main(int argc, char **argv)
{
    FILE *f;
    if (argc <= 1)
        f = fopen("/home/ubuntu/study/compiler/lab2/test", "r");
    else
        f = fopen(argv[1], "r");
    if (!f)
    {
        perror(argv[1]);
        return 1;
    }
    // yydebug = 1;
    yyrestart(f);
    yyparse(); //生成语法树
    if (myerror)
        return 1;
    // output(root, 0);
    //自顶向下分析过程，从Program文法符号开始
    Program(root);
}
